#include <cstdio>
#include <cstring>
#define INC(x, y) (x=(x+(y))%mods)

using namespace std;

typedef long long ll;
const int maxn=5000, mods=998244353;

int n, m, ind[maxn+1], to[2*maxn+1], link[2*maxn+1], val[2*maxn+1], size[maxn+1];
ll f[maxn+1][maxn+1][2][2];

void addSide(int u, int v, int w) {
    m++;
    to[m] = v;
    val[m] = w;
    link[m] = ind[u];
    ind[u] = m;
}

void buildF(int o, int fa) {
    for (int i=ind[o]; i; i=link[i]) {
        if (to[i]!=fa) buildF(to[i], o);
    }
    int n1=0, n2=0;
    static ll g[maxn+1][2][2];
    f[o][0][0][0] = 1;
    size[o] = 1;
    for (int i=ind[o]; i; i=link[i]) {
        int x=to[i];
        if (x!=fa) {
            memcpy(g, f[o], sizeof f[o]);
            memset(f[o], 0, sizeof f[o]);
            for (int j=0; j<size[o]; j++) {
                for (int k=0; k<size[to[i]]; k++) {
                    for (int u=0; u<2; u++) {
                        for (int v=0; v<2; v++) {
                            INC(f[o][j+k][u][v], g[j][u][v]*((f[x][k][0][0]+f[x][k][0][1]+f[x][k][1][0]+f[x][k][1][1])%mods)%mods);
                        }
                    }
                    if (val[i]==1) {
                        INC(f[o][j+k+1][1][0], g[j][0][0]*((f[x][k][0][0]+f[x][k][1][0])%mods)%mods);
                        INC(f[o][j+k+1][1][1], g[j][0][1]*((f[x][k][0][0]+f[x][k][1][0])%mods)%mods);
                    } else {
                        INC(f[o][j+k+1][0][1], g[j][0][0]*((f[x][k][0][0]+f[x][k][0][1])%mods)%mods);
                        INC(f[o][j+k+1][1][1], g[j][1][0]*((f[x][k][0][0]+f[x][k][0][1])%mods)%mods);
                    }
                }
            }
            size[o] += size[to[i]];
        }
    }
}

int main() {
    freopen("voltississimo.in", "r", stdin);
    freopen("voltississimo.out", "w", stdout);

    scanf("%d", &n);
    for (int i=1; i<n; i++) {
        int u, v;
        scanf("%d %d", &u, &v);
        addSide(u, v, 1);
        addSide(v, u, -1);
    }
    buildF(1, 0);

    ll ans=0, fac=1;
    for (int i=n-1; i>=0; i--) {
        fac = fac*(n-i)%mods;
        ans = (ans+mods+(i%2 ? -1 : 1)*((f[1][i][0][0]+f[1][i][0][1]+f[1][i][1][0]+f[1][i][1][1])%mods)%mods*fac%mods)%mods;
    }

    printf("%lld\n", ans);

    fclose(stdin);
    fclose(stdout);
    return 0;
}
